<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>条件渲染</title>
    <script type="text/javascript" src="../js/vue.js"></script>
</head>
<body>
    <div id="root">

        <!-- 遍历数组 -->
        <h2>人员列表</h2>
        <ul>
            <!--
                 <li v-for="p in persons"  :key="p.id">
                    {{p.name}}-{{p.age}}
                 </li> 
            -->
            <li v-for="(p,index) in persons"  :key="index">
                {{p.name}}-{{p.age}}
            </li>
        </ul>
        <!-- 遍历对象 -->
        <h2>汽车信息</h2>
        <ul>
            <li v-for="(value,k) in cars"  :key="k">
                {{k}}--{{value}}
            </li>
        </ul>
        <!-- 遍历字符串 -->
        <ul>
            <li v-for="(char,index) in str"  :key="index">
                {{index}}--{{char}}
            </li>
        </ul>
         <!-- 遍历指定次数    -->
        <ul>
            <li v-for="(number,index) in 5">
                {{index}}--{{5}}

            </li>
        </ul>
    </div>
</body>
<script type="text/javascript">
    Vue.config.productionTip = false

    const vm = new Vue({
        el:'#root',
        data(){
            return {
                persons:[
                 {id:'001',name:'张三',age:18},
                 {id:'002',name:'李四',age:19},
                 {id:'003',name:'赵五',age:20}
               ],
            cars:{
                name:"AudiA8",
                price:'70w',
                color:'black'

            },
            str:"abcdefg"   

               }
        }


    
    })


</script>

</html>